package com.zhongjh.imageingstudy.homing;

/**
 * @author zhongjh
 * 图片用于设置归位时的相关属性
 */
public class ImageHoming {

    /**
     * 坐标x、y轴
     */
    public float x, y;
    /**
     * 缩放倍率
     */
    public float scale;
    /**
     * 角度
     */
    public float rotate;

    public ImageHoming(float x, float y, float scale, float rotate) {
        this.x = x;
        this.y = y;
        this.scale = scale;
        this.rotate = rotate;
    }

    public void set(float x, float y, float scale, float rotate) {
        this.x = x;
        this.y = y;
        this.scale = scale;
        this.rotate = rotate;
    }

    public void rConcat(ImageHoming homing) {
        this.scale *= homing.scale;
        this.x -= homing.x;
        this.y -= homing.y;
    }

    public static boolean isRotate(ImageHoming sHoming, ImageHoming eHoming) {
        return Float.compare(sHoming.rotate, eHoming.rotate) != 0;
    }

    @Override
    public String toString() {
        return "IMGHoming{" +
                "x=" + x +
                ", y=" + y +
                ", scale=" + scale +
                ", rotate=" + rotate +
                '}';
    }
}
